package com.reider.log4AS3.utils
{
	import flash.utils.Dictionary;
	
	/**
	 * @private
	 */
	public class ObjectContainer
	{
		private var holder:Dictionary
		
		public function ObjectContainer()
		{
			holder = new Dictionary(true)
		}
		
		public function get length():int
		{
			var num:int = 0
			for each (var key:Object in holder){
				num++
			}
			return num
		}
		
		public function add(key:Object, obj:Object):void
		{
			holder[key] = obj
		}
		
		public function getObj(key:Object):Object
		{
			return holder[key]
		}
		
		public function getKey(obj:Object):Object
		{
			for (var key:Object in holder){
				if(holder[key] === obj){
					return key
				}
			}
			return null
		}
		
		public function hasKey(key:Object):Boolean
		{
			if(getObj(key) != null){
				return true
			}else{
				return false
			}
		}
		
		public function getDictionarry():Dictionary
		{
			return holder
		}
		
		public function remove(key:Object):void
		{
			delete holder[key]
		}
	}
}